package com.yb.nowcoder;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main10 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            List<Integer> list1 = new ArrayList<>();
            List<Integer> list2 = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                int k = in.nextInt();
                if (k % 5 == 0) {
                    list1.add(k);
                } else {
                    if (k % 3 == 0) {
                        list2.add(k);
                    }
                }
            }
            Integer sum1 = 0;
            for (Integer i : list1) {
                sum1 += i;
            }
            Integer sum2 = 0;
            for (Integer i : list2) {
                sum2 += i;
            }
            if (sum1.equals(sum2)) {
                System.out.print(true);
            }
            System.out.print(false);
        }
    }
}
